< previous page page_213 next page >

Page 213
Methods
A method is a procedure or function thats a part of an object you use. Its used to perform an action on a particular object. For example, a form is an object that has a Show method used to display the form. Theres also a Refresh method on the form object (as well as on most controls, such as text boxes). Controls are also objects and, as such, have methods. Here are the major differences between methods and procedures:
You cannot view or modify the code for a method on a Visual Basic object.
Methods are always bound to an object. You must specify the object name first and then the name of the method.
Examples of Methods
Youll need to learn a few methods for the different objects. Most are self-explanatory. Table 10.2 shows you a list of the different objects and the various methods you can invoke on those objects.
Table 10.2 Common Methods.
MethodApplies ToDescription
Me.ClsFormsClears the graphic or text drawn on a form.
HideFormsUsed to hide a form without unloading it.
LineFormsUsed to draw a line on the form area.
MoveForms, most controlsUsed to move an object from one location to another and, optionally, change the size of the object.
PaintPictureForms, graphical controlsUsed to draw a bitmap or other picture on a form, picture box, image box, or other graphical control.
PopupMenuFormsDisplays a pop-up menu over a form.
PrintFormFormsPrints the currently displayed image of the form to the default printer.

(table continued on next page)

 
< previous page page_213 next page >

If you like this book, buy it!